/*!
 * @file Root.inl
 * @author Rocco Martino
 */
/***************************************************************************
 *   Copyright (C) 2015 by Rocco Martino                                   *
 *   martinorocco@gmail.com                                                *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Lesser General Public License as        *
 *   published by the Free Software Foundation; either version 2.1 of the  *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU Lesser General Public      *
 *   License along with this program; if not, write to the                 *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef _OOVIEWER_ROOT_INL
#define _OOVIEWER_ROOT_INL




/* ======================================================================= */
/* ....................................................................... */
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
inline bool
ooViewer::Root::setScene( const std::string& name )
{
    return setScene( getSceneIDX(name) ) ;
}
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
inline bool
ooViewer::Root::setScene( int idx )
{
    if( idx < (int)m_scenes.size()  &&  idx >= 0 ) {
        m_current_scene = m_scenes[idx] ;
        return true ;
    }

    return false ;
}
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
inline int
ooViewer::Root::getSceneIDX( const std::string& name )
{
    int idx = -1 ;

    for( int i=0; i < (int)m_scenes.size(); i++ ) {

        if( m_scenes[i]->getName() == name ) {
            idx = i ;
            break ;
        }
    }

    return idx ;
}
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
inline void
ooViewer::Root::setCurrentScene( const std::string& current_scene )
{
    requestScene( current_scene ) ;
}
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
inline std::string&
ooViewer::Root::getCurrentScene(void)
{
    return m_scene_name ;
}
/* ....................................................................... */
/* ======================================================================= */




/* ======================================================================= */
/* ....................................................................... */
inline const std::string&
ooViewer::Root::getCurrentScene(void) const
{
    return m_scene_name ;
}
/* ....................................................................... */
/* ======================================================================= */




#endif /* _OOVIEWER_ROOT_INL */
